from django.contrib import admin

# Register your models here. 对需要管理的模型进行注册,注册模型类后，就可以在后台管理系统中看到它们。
from polls.models import Subject, Teacher


# admin.ModelAdmin 通过注册模型管理类，可以在后台管理系统中更好的管理模型。
class SubjectModelAdmin(admin.ModelAdmin):
    list_display = ('no', 'name', 'intro', 'is_hot')
    search_fields = ('name',)
    ordering = ('no',)


class TeacherModelAdmin(admin.ModelAdmin):
    list_display = ('no', 'name', 'sex', 'birth', 'good_count', 'bad_count', 'sno')
    search_fields = ('name',)
    ordering = ('no',)


admin.site.register(Subject, SubjectModelAdmin)
admin.site.register(Teacher, TeacherModelAdmin)
